﻿using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Prism.Events;
using System.Threading.Tasks;

namespace ModuleA.ViewModels
{
    public class ViewAViewModel : BindableBase
    {
        private string _message;
        public string Message
        {
            get { return _message; }
            set { SetProperty(ref _message, value); }
        }
        public DelegateCommand SendMesCmd { get; private set; }
        private readonly IEventAggregator _eventAggregator;
        public ViewAViewModel(IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;
            Message = "View A from your Prism Module";
            SendMesCmd = new DelegateCommand(() =>
              {
                  _eventAggregator.GetEvent<PubSubEvent<string>>().Publish(Message);
              });
        }
    }
}
